package com.pearadmin.pro.modules.stu.service.impl;

import java.util.List;
import java.util.ArrayList;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pearadmin.pro.common.web.base.page.PageResponse;
import com.pearadmin.pro.common.web.base.page.Pageable;

import com.pearadmin.pro.modules.stu.domain.StuPurpose;
import com.pearadmin.pro.modules.stu.param.StuPurposeRequest;
import com.pearadmin.pro.modules.stu.repository.StuPurposeRepository;
import com.pearadmin.pro.modules.stu.service.StuPurposeService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;


/**
 * 学生商机意向信息Service业务层处理
 *
 * @author chenJian
 * @date 2021-09-09
 */
@Service
public class StuPurposeServiceImpl extends ServiceImpl<StuPurposeRepository, StuPurpose> implements StuPurposeService
{
    @Resource
    private StuPurposeRepository stuPurposeRepository;

    /**
     * 查询学生商机意向信息
     * @param request
     * @return 学生商机意向信息 分页集合
     * */
    @Override
    public PageResponse<StuPurpose> page(StuPurposeRequest request)
    {
        LambdaQueryWrapper<StuPurpose> query = new LambdaQueryWrapper<StuPurpose>();
        query.eq(ObjectUtil.isNotEmpty(request.getBuspId()),StuPurpose::getBuspId,request.getBuspId());
        return Pageable.of(request,(()->  stuPurposeRepository.selectList(query)));
    }

    /**
     * 查询学生商机意向信息
     *
     * @param id 学生商机意向信息ID
     * @return 学生商机意向信息
     */
    @Override
    public StuPurpose selectStuPurposeById(Long id)
    {
        return stuPurposeRepository.selectById(id);
    }

}
